/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.krArmor;

import java.io.IOException;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import ru.jSky.JSkyGlobal;
import ru.jSky.ModImporter;
import ru.jSky.generator.adapter.AutoSelectionItemsGenerator;
import ru.jSky.generator.command.Command;
import ru.jSky.interfaces.Armor;
import ru.jSky.support.GrupTypeBuilder;
import skyproc.exceptions.MissingMaster;

/**
 *
 * @author Rakev
 */
public class KRArmor {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        KRArmor krArmor = new KRArmor();
        krArmor.initMod();
        EnchantmenterFactory enchantmenterFactory = new EnchantmenterFactory();
        AutoSelectionItemsGenerator<Armor> generator = enchantmenterFactory.create();
        Collection<Armor> enchantmentedArmors = generator.generate(enchantmenterFactory.getBaseArmorEdidRegex());
        Command<Collection<Armor>> levelListFiller = new LevelArmorListFillerFactory().create();
        levelListFiller.apply(enchantmentedArmors);
    }

    private void initMod() {
        try {
            JSkyGlobal.getInstance().beginCreatingMod("KepperV", "KRArmor");
            JSkyGlobal.getInstance().setPathToData("C:\\Steam\\SteamApps\\common\\skyrim\\Data\\");
            GrupTypeBuilder typeBuilder = new GrupTypeBuilder();
            typeBuilder.ARMO().ENCH().KYWD().LVLI();
            ModImporter.getInstance().importActiveMods(typeBuilder.build());
            JSkyGlobal.getInstance().setCodePoint("cp1251", "cp1252");
        } catch (IOException ex) {
            Logger.getLogger(KRArmor.class.getName()).log(Level.SEVERE, null, ex);
        } catch (MissingMaster ex) {
            Logger.getLogger(KRArmor.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
